package br.com.agenda.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "TAREFA")
public class TarefaEntity implements Serializable {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer			codTarefa;

	private String			nome;

	@Temporal(TemporalType.TIMESTAMP)
	private Date		dhInicial;

	@Temporal(TemporalType.TIMESTAMP)
	private Date		dhFinal;

	@ManyToMany(targetEntity = UsuarioEntity.class)
	@JoinTable(name = "USUARIO_TAREFA", joinColumns = @JoinColumn(name = "CODUSU"), inverseJoinColumns = @JoinColumn(name = "CODTAREFA"))
	private Set<UsuarioEntity>	usuarios;

	public Set<UsuarioEntity> getUsuarios() {
		return usuarios;
	}

	public Integer getCodTarefa() {
		return codTarefa;
	}

	public void setCodTarefa(Integer codTarefa) {
		this.codTarefa = codTarefa;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public Date getDhInicial() {
		return dhInicial;
	}

	public void setDhInicial(Date dhInicial) {
		this.dhInicial = dhInicial;
	}

	public Date getDhFinal() {
		return dhFinal;
	}

	public void setDhFinal(Date dhFinal) {
		this.dhFinal = dhFinal;
	}
}
